package com.jxwifi.cloud.quickcleanserver.presenter;

import android.util.Log;

import com.alibaba.fastjson.JSON;
import com.bigkoo.pickerview.OptionsPickerView;
import com.jxwifi.cloud.quickcleanserver.app.UrlPool;
import com.jxwifi.cloud.quickcleanserver.bean.ChannelTraderBean;
import com.jxwifi.cloud.quickcleanserver.model.AuzImpl;
import com.jxwifi.cloud.quickcleanserver.okhttp.Params;
import com.jxwifi.cloud.quickcleanserver.utils.LocationGaoDe;
import com.jxwifi.cloud.quickcleanserver.view.ContactNameView;
import com.jxwifi.cloud.quickcleanserver.view.ContactView;

import java.util.ArrayList;
import java.util.List;

public class AuthenticationPresenter {

    private String TAG = this.getClass().getSimpleName();

    private AuzImpl mImpl;

    private ContactNameView mContactView;

    public AuthenticationPresenter(ContactNameView mContactView) {
        this.mContactView = mContactView;
        mImpl = new AuzImpl();
    }

    public void initChannelProviderData(){

        Params params = new Params();
        Log.i(TAG, "province = " + LocationGaoDe.getProvince() + " city = " + LocationGaoDe.getCity() + " area = " + LocationGaoDe.getDistrict());
        params.add("area", LocationGaoDe.getDistrict());//area
        params.add("city", LocationGaoDe.getCity());//city
        params.add("province", LocationGaoDe.getProvince());//province
        mImpl.auzpost(UrlPool.POST_CHANNELTRADER, params, new AuzImpl.AuzListener() {
            @Override
            public void AuzSuccess(int code, String data) {
                Log.i(TAG,"initChannelProviderData ==> data = "+ JSON.toJSONString(data));
                mContactView.onSuccess(code, data);

            }

            @Override
            public void AuzFailure(int errorCode, String msg) {
                mContactView.onFailure(errorCode, msg);
            }
        });

    }

}
